;; Copyright (C) 2010 ahei

; Author: ahei <ahei0802@gmail.com>
;; URL: http://code.google.com/p/dea/source/browse/trunk/my-lisps/dired-settings.el
;; Time-stamp: <2014-10-19 15:36:36 星期日 by wujing>

;; This file is heavily modified to meet my personal demands

;; This  file is free  software; you  can redistribute  it and/or
;; modify it under the terms of the GNU General Public License as
;; published by  the Free Software Foundation;  either version 3,
;; or (at your option) any later version.

;; This file is  distributed in the hope that  it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR  A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You  should have  received a  copy of  the GNU  General Public
;; License along with  GNU Emacs; see the file  COPYING.  If not,
;; write  to  the Free  Software  Foundation,  Inc., 51  Franklin
;; Street, Fifth Floor, Boston, MA 02110-1301, USA.

(require 'dired+)
(require 'dired-lis)

;; allow dired to be able to delete or copy a whole dir.
(setq dired-recursive-deletes 'top
      dired-recursive-copies 'always
      dired-dwim-target t
	  dired-listing-switches "-Al --si --time-style long-iso")

(setq ls-lisp-dirs-first t)


(defun dired-up-directory-same-buffer ()
  "Goto parent directory in the smae buffer."
  (interactive)
  (let* ((dir (dired-current-directory))
		 (dir-file-name (directory-file-name dir))
		 (mode dired-lis-mode))
	(unless (string= dir dir-file-name)
	  (find-alternate-file "..")
	  (dired-goto-file dir-file-name)
	  (dired-lis-mode (if mode 1 -1)))))

(define-key dired-mode-map (kbd "<backspace>") 'dired-up-directory-same-buffer)


(provide 'dired-settings)
